"""组织架构页面"""
from page.base_page import BasePage
from selenium.webdriver.common.by import By

class organiztionPage(BasePage):
    url="/crm5/index.php?m=user"
    #定位器
    # 添加用户的定位器
    btn_add_users_locator = (By.CSS_SELECTOR, '#user_form > div:nth-child(1) > div > a:nth-child(3)')
    #添加成功定位器
    add_success_locator = (By.CSS_SELECTOR, 'body > div.container > div.alert.alert-success')
    # 组织架构中的组织架构定位器
    organization2_locator = (By.CSS_SELECTOR,
                             'body > div.container > div.page-header > h4 > small > a:nth-child(1)')
    # 查看admin定位器
    look_locator = (By.CSS_SELECTOR,
                    '#user_form > div:nth-child(2) > table > tbody > tr:nth-child(1) > td:nth-child(8) > a:nth-child(1) > i')



    def click_add_users(self):
        """点击添加用户按钮的方法"""
        self.driver.find_element(*self.btn_add_users_locator).click()
    def get_success_text(self):
        """添加成功的文本"""
        return self.driver.find_element(*self.add_success_locator).text
    def click_organization2(self):
        """点击组织架构中的组织架构"""
        self.driver.find_element(*self.organization2_locator).click()
    def click_look(self):
        """点击用户信息的查看"""
        self.driver.find_element(*self.look_locator).click()

